package com.shhic.hhplt.server.biz;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import com.shhic.hhplt.server.service.ITestReportService;
import org.springframework.stereotype.Service;

import com.shhic.hhplt.server.model.ProductSuite;
import com.shhic.hhplt.server.model.ProductSuiteQuery;

@Service
public class ProductQuery {
	
	@Resource
	ITestReportService trService;
	
	public ProductSuite getProductIdCodeByTestSuiteBarCode(String productName, String suiteName, String barCode){
		ProductSuiteQuery q = new ProductSuiteQuery();
		q.setBarCode(barCode);
		q.setProductName(productName);
		q.setSuiteName(suiteName.equals("") ? null : suiteName);
		q.setStartDate(0);
		q.setEndDate(new Date().getTime());
		List<ProductSuite> psl = trService.queryProductSuite(q);
		if(psl == null || psl.isEmpty()){
			return null;
		}
//		ProductSuite productSuite = psl.get(0);
		return psl.get(0);
	}	
}
